<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <link href="../dist/index.css" rel="stylesheet">
</head>
<body>

<div id="app"></div>

<script src="https://cdn.jsdelivr.net/npm/vue@next"></script>
<script src="../dist/index.js"></script>

<script>
  console.log(window.PlainUIV3)

  const app = window.Vue.createApp({
    template: `
            <div>
                <pl-button label="label"></pl-button>
                <pl-button>插槽内容</pl-button>

                <pl-input/>
                <pl-input status="error" ref="myInput"/>
                <button @click="outerFocus">outerFocus</button>
            </div>
        `,
    setup() {
      const inputRef = window.PlainUIV3.Input.use.ref('myInput') //这里内部会调用getCurrentInstance,而这个getCurrentInstance此时得到的是当前上下文的实例, 即我们这里的根实例(而不Input的组件实例), 也因此我们能拿到我们input组件的ref(ref是存放在调用组件的那个上下文的vue实例中的)

      return {
        outerFocus() {
          inputRef.value.methods.focus(false)
        },
      }
    },
  })

  app.use(window.PlainUIV3)

  app.mount('#app')
</script>

</body>
</html>
